<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: D:/Projects/MiXiM/extsrc/mixim/src/modules/utility/IEEE802154A.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00494.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">IEEE802154A.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode:c++ -*- ********************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> * file:        IEEE802154A.h</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * author:      Jerome Rousselot &lt;jerome.rousselot@csem.ch&gt;</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * copyright:   (C) 2008 Centre Suisse d&#39;Electronique et Microtechnique (CSEM) SA</span>
<a name="l00007"></a>00007 <span class="comment"> *        Systems Engineering</span>
<a name="l00008"></a>00008 <span class="comment"> *              Real-Time Software and Networking</span>
<a name="l00009"></a>00009 <span class="comment"> *              Jaquet-Droz 1, CH-2002 Neuchatel, Switzerland.</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> *              This program is free software; you can redistribute it</span>
<a name="l00012"></a>00012 <span class="comment"> *              and/or modify it under the terms of the GNU General Public</span>
<a name="l00013"></a>00013 <span class="comment"> *              License as published by the Free Software Foundation; either</span>
<a name="l00014"></a>00014 <span class="comment"> *              version 2 of the License, or (at your option) any later</span>
<a name="l00015"></a>00015 <span class="comment"> *              version.</span>
<a name="l00016"></a>00016 <span class="comment"> *              For further information see file COPYING</span>
<a name="l00017"></a>00017 <span class="comment"> *              in the top level directory</span>
<a name="l00018"></a>00018 <span class="comment"> * description: this class holds constants specified in IEEE 802.15.4A UWB-IR Phy</span>
<a name="l00019"></a>00019 <span class="comment"> * acknowledgment: this work was supported (in part) by the National Competence</span>
<a name="l00020"></a>00020 <span class="comment"> *          Center in Research on Mobile Information and Communication Systems</span>
<a name="l00021"></a>00021 <span class="comment"> *        NCCR-MICS, a center supported by the Swiss National Science</span>
<a name="l00022"></a>00022 <span class="comment"> *        Foundation under grant number 5005-67322.</span>
<a name="l00023"></a>00023 <span class="comment"> ***************************************************************************/</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#ifndef _IEEE802154A_H</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define _IEEE802154A_H</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;utility&gt;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;MiXiMDefs.h&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;Signal_.h&quot;</span>
<a name="l00033"></a>00033 
<a name="l00044"></a><a class="code" href="a00099.html">00044</a> <span class="keyword">class </span>MIXIM_API <a class="code" href="a00099.html" title="This class regroups static methods needed to generate a pulse-level representation of an IEEE 802...">IEEE802154A</a>
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046     <span class="keyword">public</span>:
<a name="l00048"></a><a class="code" href="a00099.html#a8c84b3445fe73278870a24330004e0e6">00048</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="a00099.html#a8c84b3445fe73278870a24330004e0e6" title="bit rate (850 kbps)">mandatory_bitrate</a>;
<a name="l00050"></a><a class="code" href="a00099.html#aa8d1a0b27a1b2ccc525ead952f31e0e7">00050</a>         <span class="keyword">static</span> const_simtime_t <a class="code" href="a00099.html#aa8d1a0b27a1b2ccc525ead952f31e0e7" title="mandatory data symbol length (1025 ns)">mandatory_symbol</a>;
<a name="l00052"></a><a class="code" href="a00099.html#a005f42d18095aaaf846f3e03ecee2309">00052</a>         <span class="keyword">static</span> const_simtime_t <a class="code" href="a00099.html#a005f42d18095aaaf846f3e03ecee2309" title="0.5 * mandatory_symbol (0.5 ms)">mandatory_timeShift</a>;
<a name="l00054"></a><a class="code" href="a00099.html#ab29d6f969fd0446306f9bca3d0f2bf66">00054</a>         <span class="keyword">static</span> const_simtime_t <a class="code" href="a00099.html#ab29d6f969fd0446306f9bca3d0f2bf66" title="mandatory pulse duration ( = 1 / bandwidth = 2 ns)">mandatory_pulse</a>;
<a name="l00056"></a><a class="code" href="a00099.html#af3cec63cea77a050a1a2684bad6914cc">00056</a>         <span class="keyword">static</span> const_simtime_t <a class="code" href="a00099.html#af3cec63cea77a050a1a2684bad6914cc" title="burst duration">mandatory_burst</a>;
<a name="l00058"></a><a class="code" href="a00099.html#a5ff4c70e28d60089caaa6fecfd5b5a39">00058</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="a00099.html#a5ff4c70e28d60089caaa6fecfd5b5a39" title="number of consecutive pulses forming a burst">mandatory_pulses_per_burst</a>;
<a name="l00060"></a><a class="code" href="a00099.html#a2c140f7b73792a8634cfd64f1145d531">00060</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="a00099.html#a2c140f7b73792a8634cfd64f1145d531" title="Center frequency of band 3 in UWB lower band (500 MHz wide channel)">mandatory_centerFreq</a>; <span class="comment">// in MHz !</span>
<a name="l00062"></a><a class="code" href="a00099.html#affd046f553e39d7b550e45a337cb3f4d">00062</a> <span class="comment"></span>        <span class="keyword">static</span> const_simtime_t <a class="code" href="a00099.html#affd046f553e39d7b550e45a337cb3f4d" title="default sync preamble length">mandatory_preambleLength</a>;
<a name="l00064"></a><a class="code" href="a00099.html#ab7d6e3933f81151296996c211053a5bd">00064</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="a00099.html#ab7d6e3933f81151296996c211053a5bd" title="Total triangular pulse peak energy in mW (0 dBm / 50 MHz over 500 MHz)">maxPulse</a>;
<a name="l00065"></a>00065 
<a name="l00066"></a>00066         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> C31[8][31];
<a name="l00067"></a>00067 
<a name="l00068"></a>00068         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> Ci = 5;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> shortSFD[8];
<a name="l00071"></a>00071 
<a name="l00072"></a>00072         <span class="keyword">static</span> const_simtime_t MaxFrameDuration;
<a name="l00073"></a>00073 
<a name="l00074"></a>00074         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> maxS = 20000;
<a name="l00075"></a>00075         <span class="keyword">static</span> <span class="keywordtype">short</span> s_array[maxS];
<a name="l00076"></a>00076         <span class="keyword">static</span> <span class="keywordtype">int</span> last_s;
<a name="l00077"></a>00077 
<a name="l00078"></a>00078         <span class="keyword">static</span> <span class="keywordtype">double</span> signalStart; <span class="comment">// we cannot use a simtime_t here because the scale exponent is not yet known at initialization.</span>
<a name="l00079"></a>00079 
<a name="l00081"></a><a class="code" href="a00099.html#ad50f579cfe38ba679b1087ea9d3cce53">00081</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> NSync = 64; <span class="comment">// default sync preamble length</span>
<a name="l00083"></a><a class="code" href="a00099.html#aae1e48e3b33a1f7fbd0911eb96ee1c01">00083</a> <span class="comment"></span>        <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> CLength = 31;
<a name="l00085"></a><a class="code" href="a00099.html#a939ab58daadc8dfad4ce9a6c8732934f">00085</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> spreadingdL = 16;
<a name="l00087"></a><a class="code" href="a00099.html#a43bcd01c6ca4f2ed72f35ed4dd16fbc7">00087</a>         <span class="keyword">static</span> const_simtime_t <a class="code" href="a00099.html#a43bcd01c6ca4f2ed72f35ed4dd16fbc7" title="duration of a synchronization preamble symbol">Tpsym</a>;
<a name="l00088"></a>00088 
<a name="l00090"></a><a class="code" href="a00099.html#a825ce96a86c8a93cdc4fc0446d1d0911">00090</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> RSSymbolLength = 6;
<a name="l00092"></a><a class="code" href="a00099.html#a12e3b9012f5d8a46f061263302cd22e0">00092</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">short</span> RSMaxSymbolErrors = 4; <span class="comment">// =(n-k)/2</span>
<a name="l00093"></a>00093 
<a name="l00095"></a><a class="code" href="a00099.html#a13b879798f5bed79e9839e8888b1037b">00095</a>         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> MaxPSDULength = 128;
<a name="l00096"></a>00096 
<a name="l00098"></a><a class="code" href="a00099.html#afd394e4b3807e9fe040354275a62949d">00098</a>         <span class="keyword">static</span> const_simtime_t <a class="code" href="a00099.html#afd394e4b3807e9fe040354275a62949d" title="Position of the first pulse max in the frame.">tFirstSyncPulseMax</a>;
<a name="l00099"></a>00099 
<a name="l00100"></a>00100         <span class="keyword">enum</span> UWBPRF
<a name="l00101"></a>00101         {
<a name="l00102"></a>00102             PRF_OFF, NOMINAL_4_M, NOMINAL_16_M, NOMINAL_64_M
<a name="l00103"></a>00103         };
<a name="l00104"></a>00104 
<a name="l00105"></a>00105         <span class="keyword">enum</span> Ranging
<a name="l00106"></a>00106         {
<a name="l00107"></a>00107             NON_RANGING, ALL_RANGING, PHY_HEADER_ONLY
<a name="l00108"></a>00108         };
<a name="l00109"></a>00109 
<a name="l00110"></a>00110         <span class="keyword">enum</span> UWBPreambleSymbolRepetitions
<a name="l00111"></a>00111         {
<a name="l00112"></a>00112             PSR_SHORT = 16, PSR_DEFAULT = 64, PSR_MEDIUM = 1024, PSR_LONG = 4096
<a name="l00113"></a>00113         };
<a name="l00114"></a>00114 
<a name="l00115"></a>00115         <span class="keyword">enum</span> DataRate
<a name="l00116"></a>00116         {
<a name="l00117"></a>00117             DATA_RATE_0, DATA_RATE_1, DATA_RATE_2, DATA_RATE_3, DATA_RATE_4
<a name="l00118"></a>00118         };
<a name="l00119"></a>00119 
<a name="l00120"></a>00120     <span class="keyword">public</span>:
<a name="l00122"></a><a class="code" href="a00051.html">00122</a>         <span class="keyword">struct </span><a class="code" href="a00051.html" title="currently unused">config</a>
<a name="l00123"></a>00123         {
<a name="l00124"></a>00124                 <span class="keywordtype">int</span> channel;
<a name="l00125"></a>00125                 UWBPRF prf;
<a name="l00126"></a>00126                 Ranging ranging;
<a name="l00127"></a>00127                 UWBPreambleSymbolRepetitions NSync;
<a name="l00128"></a>00128                 <span class="keywordtype">int</span> CLength;
<a name="l00129"></a>00129                 <span class="keywordtype">int</span> spreadingdL; <span class="comment">// spreading deltaL</span>
<a name="l00130"></a>00130                 <span class="keywordtype">int</span> Ncpb;
<a name="l00131"></a>00131                 <span class="keywordtype">int</span> bitrate;
<a name="l00132"></a>00132                 <span class="keywordtype">int</span> nbPulsesPerBurst;
<a name="l00133"></a>00133 
<a name="l00134"></a>00134 <span class="comment">//      simtime_t sync_symbol_duration;</span>
<a name="l00135"></a>00135 <span class="comment">//      simtime_t data_symbol_duration;</span>
<a name="l00136"></a>00136 <span class="comment">//      simtime_t shift_duration;</span>
<a name="l00137"></a>00137 <span class="comment">//      simtime_t pulse_duration;</span>
<a name="l00138"></a>00138 <span class="comment">//      simtime_t burst_duration;</span>
<a name="l00139"></a>00139 <span class="comment">//      simtime_t preambleLength;</span>
<a name="l00140"></a>00140                 <span class="keywordtype">double</span> sync_symbol_duration;
<a name="l00141"></a>00141                 <span class="keywordtype">double</span> data_symbol_duration;
<a name="l00142"></a>00142                 <span class="keywordtype">double</span> shift_duration;
<a name="l00143"></a>00143                 <span class="keywordtype">double</span> pulse_duration;
<a name="l00144"></a>00144                 <span class="keywordtype">double</span> burst_duration;
<a name="l00145"></a>00145                 <span class="keywordtype">double</span> preambleLength;
<a name="l00146"></a>00146 
<a name="l00147"></a>00147                 <span class="keywordtype">double</span> centerFrequency;
<a name="l00148"></a>00148         };
<a name="l00149"></a>00149 
<a name="l00150"></a>00150         <span class="keyword">typedef</span> std::pair&lt;Signal *, std::vector&lt;bool&gt; *&gt; signalAndData;
<a name="l00151"></a>00151 
<a name="l00152"></a>00152         <span class="comment">/* @brief Sets the configuration of the IEEE802.15.4A standard.</span>
<a name="l00153"></a>00153 <span class="comment">         *  Use this (and the struct config) to implement optional modes of the standard. */</span>
<a name="l00154"></a>00154         <span class="keyword">static</span> <span class="keywordtype">void</span> setConfig(<a class="code" href="a00051.html" title="currently unused">config</a> newCfg);
<a name="l00155"></a>00155 
<a name="l00156"></a>00156         <span class="keyword">static</span> <a class="code" href="a00051.html" title="currently unused">config</a> getConfig()
<a name="l00157"></a>00157         {
<a name="l00158"></a>00158             <span class="keywordflow">return</span> cfg;
<a name="l00159"></a>00159         }
<a name="l00160"></a>00160 
<a name="l00161"></a>00161         <span class="comment">// sets the number of data bytes to encode in the data structure.</span>
<a name="l00162"></a>00162         <span class="keyword">static</span> <span class="keywordtype">void</span> setPSDULength(<span class="keywordtype">int</span> _psduLength);
<a name="l00163"></a>00163 
<a name="l00164"></a>00164         <span class="comment">/* @brief Generates a frame starting at time signalStart and composed of</span>
<a name="l00165"></a>00165 <span class="comment">         * psduLength bytes of data (this value must be set before by using setPSDULength()).</span>
<a name="l00166"></a>00166 <span class="comment">         * If allZeros is set to true, all bit values are equal to zero.</span>
<a name="l00167"></a>00167 <span class="comment">         * If it is set to false or undefined, bit values are generated randomly.</span>
<a name="l00168"></a>00168 <span class="comment">         * The returned structure is a pair. Its first component is the Signal*,</span>
<a name="l00169"></a>00169 <span class="comment">         * and the second component is a vector of bool with the the generated bit values.</span>
<a name="l00170"></a>00170 <span class="comment">         * */</span>
<a name="l00171"></a>00171         <span class="keyword">static</span> signalAndData generateIEEE802154AUWBSignal(simtime_t_cref signalStart, <span class="keywordtype">bool</span> allZeros = <span class="keyword">false</span>);
<a name="l00172"></a>00172 
<a name="l00173"></a>00173         <span class="keyword">static</span> simtime_t getMaxFrameDuration();
<a name="l00174"></a>00174 
<a name="l00175"></a>00175 <span class="comment">// Constants from standard</span>
<a name="l00176"></a>00176         <span class="comment">/* @brief Always 16 symbols for the PHY header */</span>
<a name="l00177"></a>00177         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> Nhdr = 16;
<a name="l00178"></a>00178 
<a name="l00179"></a>00179     <span class="keyword">protected</span>:
<a name="l00180"></a>00180         <span class="keyword">static</span> <span class="keywordtype">void</span> generateSyncPreamble(<a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* mapping, <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>* arg);
<a name="l00181"></a>00181         <span class="keyword">static</span> <span class="keywordtype">void</span> generateSFD(<a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* mapping, <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>* arg);
<a name="l00182"></a>00182         <span class="keyword">static</span> <span class="keywordtype">void</span> generatePhyHeader(<a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* mapping, <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>* arg);
<a name="l00183"></a>00183         <span class="keyword">static</span> <span class="keywordtype">void</span> generateBurst(<a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* mapping, <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>* arg, simtime_t_cref burstStart, <span class="keywordtype">short</span> polarity);
<a name="l00184"></a>00184         <span class="keyword">static</span> <span class="keywordtype">void</span> generatePulse(<a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* mapping, <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>* arg, <span class="keywordtype">short</span> polarity, <span class="keywordtype">double</span> peak = <a class="code" href="a00099.html#ab7d6e3933f81151296996c211053a5bd" title="Total triangular pulse peak energy in mW (0 dBm / 50 MHz over 500 MHz)">IEEE802154A::maxPulse</a>,
<a name="l00185"></a>00185                 simtime_t_cref chip = <a class="code" href="a00099.html#ab29d6f969fd0446306f9bca3d0f2bf66" title="mandatory pulse duration ( = 1 / bandwidth = 2 ns)">IEEE802154A::mandatory_pulse</a>);
<a name="l00186"></a>00186         <span class="keyword">static</span> <span class="keywordtype">void</span> setBitRate(<a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>* s);
<a name="l00187"></a>00187         <span class="keyword">static</span> <span class="keywordtype">int</span> s(<span class="keywordtype">int</span> n);
<a name="l00188"></a>00188 
<a name="l00189"></a>00189     <span class="keyword">public</span>:
<a name="l00190"></a>00190         <span class="keyword">static</span> <span class="keywordtype">int</span> psduLength;
<a name="l00191"></a>00191         <span class="keyword">static</span> config cfg;
<a name="l00192"></a>00192         <span class="keyword">static</span> <span class="keyword">const</span> config cfg_mandatory_16M;
<a name="l00193"></a>00193         <span class="keyword">static</span> <span class="keyword">const</span> config cfg_mandatory_4M;
<a name="l00194"></a>00194 
<a name="l00195"></a>00195         <span class="comment">// Compute derived parameters</span>
<a name="l00196"></a>00196         <span class="keyword">static</span> simtime_t getPhyMaxFrameDuration();
<a name="l00197"></a>00197         <span class="keyword">static</span> simtime_t getThdr();
<a name="l00198"></a>00198         <span class="keyword">static</span> <span class="keywordtype">int</span> getHoppingPos(<span class="keywordtype">int</span> sym);
<a name="l00199"></a>00199 
<a name="l00200"></a>00200 };
<a name="l00201"></a>00201 
<a name="l00202"></a>00202 <span class="preprocessor">#endif  </span><span class="comment">/* _IEEE802154A_H */</span>
<a name="l00203"></a>00203 
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>IEEE802154A.h</b>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:30 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
